﻿using System;
using Windows.Networking;
using Windows.Networking.Connectivity;
using System.Collections.Generic;
using Beyondsoft.Tuanju.DataManager;
using Tuan.Common;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.Networking.Sockets;

namespace Tuan
{
    public sealed partial class ItemDetailsPage : LayoutAwarePage
    {
        /// <summary>
        /// Initialize ItemDetailsPage
        /// </summary>
        public ItemDetailsPage()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Binding context data when loading this page
        /// </summary>
        /// <param name="navigationParameter">Navigation parameter</param>
        /// <param name="pageState">Page state</param>
        protected override async void LoadState(object navigationParameter, Dictionary<string, object> pageState)
        {
            this.CityName.DataContext = City.DefaultCity;

            Deal deal = await City.DefaultCity.GetDeal((String)navigationParameter);

            this.dealInfoPanel.DataContext = deal;
        }

        /// <summary>
        /// Show decription panel when click "概述"
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">agrument</param>
        private void DescriptionButton_Click(object sender, RoutedEventArgs e)
        {
            Canvas.SetZIndex(this.Discription1, 2);
            Canvas.SetZIndex(this.Discription2, 1); ;
        }

        /// <summary>
        /// Show details panel when click "详细信息"
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">agrument</param>
        private void DetailsButton_Click(object sender, RoutedEventArgs e)
        {
            Canvas.SetZIndex(this.Discription1, 1);
            Canvas.SetZIndex(this.Discription2, 2);
        }
    }
}
